using System;
using System.Collections.Generic;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TestSystem.BLL;
using TestSystem.BLL.TestSystem;


public partial class Controls_QuizList : System.Web.UI.UserControl
{
    private int subjectID;
    public int SubjectID
    {
        get { return subjectID; }
        set { subjectID = value; }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            
            Subject subject = Subject.GetBySubjectID(SubjectID);
            lnkSubject.Text = subject.SubjectName;
            lnkSubject.NavigateUrl = String.Format(lnkSubject.NavigateUrl, SubjectID);
            if(Utils.IsAdmin)
                quizes.DataSource = subject.Quizes;
            else
            {
                quizes.DataSource = Quiz.GetBySubjectID(SubjectID, false, true);
            }
            quizes.DataBind();
        }
    }
}
